const app = getApp();
var addCode = wx.getStorageSync("addCode") ? wx.getStorageSync("addCode") : "33";
Page({
  data: {
    pageno: 1,
    renderObj: {
      listArr: [],
    },
    picHost:'http://appapp.b0.upaiyun.com',
  },
  activityPicDetails: function (e) {
    var id = app.getBindDataSet(e).id
    wx.navigateTo({
      url: '../../pages/activityPicturesDetails/activityPicturesDetails?id='+id
    })
  },
  onLoad: function () {
    wx.setNavigationBarTitle({
      title: '活动图片',
    });
    this.initPage();
  },
  initPage: function () {
    let _this = this;
    // app.galleryWidth = (document.body.clientWidth - 60) / 3;
    app.doReq(app.globalData.SERVICE.INDEX.PHOTOLIST, {
      "pagesize": 12,
      "pageno": _this.data.pageno,
      "code": addCode
    }, 'GET',function (res) {
      console.log(res);
      if (_this.data.pageno == 1) {
        _this.setData({
          renderObj: {
            listArr: res.data.pageitems,
          },
          pageCount: res.data.pagecount
        });
      } else {
        _this.setData({
          renderObj: {
            listArr: _this.data.renderObj.listArr.concat(res.data.pageitems)
          },
        });
      }
    });
  },
  onReachBottom: function () {//刷新
    var _this = this;
    var currentPageNo = _this.data.pageno;
    if (currentPageNo <= _this.data.pageCount) {
      _this.data.pageno++;
      _this.initPage({});
    }
  },
})